home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-07-19 | 2.7 KB | 92 lines | [TEXT/EDIT] |
-
- REM This is listing 2 and is usable in MS BASIC 3.0 or greater
- REM create a macdraw PICT file
- REM Tech Note # 27 specifies the PICT file structure that is expected by MacDraw
-
- LIBRARY "MSTools"
-
- DIM Grey%(3)
- RESTORE PatternData
- FOR j% = 0 TO 3 : READ Grey%(j%) : NEXT
-
- PatternData:
- DATA -21931,-21931,-21931,-21931
-
- REM define some objects that will be used for this demonstration
- REM read in the data that define the rectangle and circle
-
- DIM rect%(3),aCircle%(3)
- RESTORE ObjectData
- READ rect%(0)
- READ rect%(1)
- READ rect%(2)
- READ rect%(3)
- READ aCircle%(0)
- READ aCircle%(1)
- READ aCircle%(2)
- READ aCircle%(3)
-
- ObjectData:
- DATA 10,10,110,150,100,100,200,200
-
- X.Offset = 0 'offset to be used in saving the picture in MacDraw
- Y.Offset = 0 ' if offsets are not zero the picture will have an upper 'right corner at that location
-
- REM record first picture with pen on so we can see it
- PICTURE ON
- CALL SHOWPEN
- CALL PENSIZE(3,1)
- CALL FRAMERECT(VARPTR(rect%(0)))
- CALL PENNORMAL
-
- CALL PENPAT(VARPTR(Grey%(0)))
- CALL PAINTOVAL(VARPTR(aCircle%(0)))
-
- CALL PENSIZE(3,3)
- FOR indx% = 0 TO 3 : aCircle%(indx%) = aCircle%(indx%) + 50 : NEXT
-
- CALL FRAMEOVAL(VARPTR(aCircle%(0)))
- CALL PENNORMAL
-
- CALL MOVETO (10,10)
- CALL LINETO (100,200)
-
- PICTURE OFF
- pict1$ = PICTURE$
-
- REM now start the second picture as polygon
- PGon! = 0
- openPGon PGon!
- CALL MOVETO(100,100)
- FOR indx% = 1 TO 20
- CALL LINE(indx%,10*SIN(indx%))
- NEXT
- CLOSEPGon
-
- PICTURE ON
- FramePgon PGon!
- PICTURE OFF
- pict2$ = PICTURE$
-
- REM we must group all of the separate pictures as a single picture
- REM before they can be outputted to the MacDraw™ PICT file
- CALL HIDEPEN
- PICTURE ON
- PICTURE (X.Offset,Y.Offset), pict1$ 'use any valid offset you wish
- PICTURE (X.Offset,Y.Offset), pict2$ 'use same offset to get 'relationship right
- PICTURE OFF
- Pict$ = PICTURE$
-
- File.Pict$ = FILES$(0,"Name for this Picture ?") 'get the name of the file
- IF LEN(File.Pict$) < 5 THEN END 'if no file name then quit
-
- OPEN File.Pict$ FOR OUTPUT AS #1
- FOR indx% = 1 TO 512 'print out the header for the PICT file
- PRINT #1,CHR$(0); ' note use of ; to prevent chr$(13)
- NEXT
- PRINT #1,Pict$; ' Print out the picture to the file
- CLOSE #1
- NAME File.Pict$ AS File.Pict$,"PICT" 'type the file as PICT so can open 'from inside MacDraw™
- Setcreate File.Pict$ , "MDRW"
-
-